import java.util.Scanner;

public class MethodTest4 {
    public MethodTest4() {
    }

    public static void main(String[] args) {
        System.out.println("最终的平均分是：" + getAvgScore(5));
    }

    public static int getAvgScore(int number) {
        int[] scores = new int[number];

        int max;
        for(max = 0; max < scores.length; ++max) {
            System.out.println("请输入第" + (max + 1) + "个评委打分");
            Scanner sc = new Scanner(System.in);
            scores[max] = sc.nextInt();
        }

        max = scores[0];
        int min = scores[0];
        int sum = 0;

        int i;
        for(i = 0; i < scores.length; ++i) {
            if (max < scores[i]) {
                max = scores[i];
            } else {
                min = scores[i];
            }

            sum += scores[i];
        }

        i = (sum - max - min) / number;
        return i;
    }
}